www.gusucode.com > 婚庆仪礼策划公司网站系统源代码 梦紫色 > 婚庆仪礼策划公司网站系统源代码 梦紫色/Admin/admin_p_class.asp

    <!--#include file="conn.asp"-->
<!--#include file="inc/format.asp"-->
<!--#include file="inc/error.asp"-->
<!--#include file="check1.asp"-->
<!--#include file="inc/p_class_body.asp"-->

<title>错误提示</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim founderr,errmsg
founderr=false
errmsg=""

if Request.form("MM_insert") then

if request.form("action")="new" then
sql="select * from p_class"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim p_type
p_type=trim(replace(request.form("p_type"),"'",""))
if p_type="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称名称!"
else
  rs("p_type")=p_type
End if
if Not founderr then
rs.update
rs.close
set rs=Nothing
  closedatabase
response.redirect "admin_p_class.asp"
else
Call diserror()
response.End
End if
End if

if request.form("action")="edit" then
if request.Form("id")="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
  if Not isInteger(request.form("id")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的id参数。"
  End if
End if
if founderr then
  Call diserror()
  response.End
End if
sql="select * from p_class where p_id="&cint(request.Form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
p_old_type=rs("p_type")
p_type=trim(replace(request.form("p_type"),"'",""))
if p_type="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称!"
else
  rs("p_type")=p_type
End if

if Not founderr then
rs.update
rs.close
set rs=Nothing
'连代更新二级分类
v_sql="select * from p_class_small where p_type='"&p_old_type&"'"
response.write v_sql
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs("p_type")=p_type
v_rs.update
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
'连代更新属于此大类的信息
v_sql="select * from p_info where p_type='"&p_old_type&"'"
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs("p_type")=p_type
v_rs.update
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
response.redirect "admin_p_class.asp"
else
Call diserror()
response.End
End if
End if

if request.form("action")="del" then
if request.Form("id")="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
  if Not isInteger(request.form("id")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的id参数。"
  End if
End if
if founderr then
  Call diserror()
  response.End
End if
sql="select * from p_class where p_id="&cint(request.Form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if Not(rs.BOF or rs.EOF) then
p_type=rs("p_type")
rs.delete
End if
rs.close
set rs=Nothing
'连代删除二级分类
v_sql="select * from p_class_small where p_type='"&p_type&"'"
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs.delete
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
'连代删除属于此大类的信息
v_sql="select * from p_info where p_type='"&p_type&"'"
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs.delete
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
closedatabase
response.redirect "admin_p_class.asp"
End if
''''''''''''''''''''''''''''''''''''''''''''''''
'二级分类的添加,修改,删除操作
''''''''''''''''''''''''''''''''''''''''''''''''
if request.form("action")="p" then
sql="select * from p_class_small"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
dim p_small_type'p_type已经定义
p_type=trim(replace(request.form("p_type"),"'",""))
p_small_type=trim(replace(request.form("p_small_type"),"'",""))
if p_small_type="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称!"
else
  rs("p_small_type")=p_small_type
End if
if Not founderr then
rs("p_type")=p_type
rs.update
rs.close
set rs=Nothing
  closedatabase
response.redirect "admin_p_class.asp"
else
Call diserror()
response.End
End if
End if

if request.form("action")="edits" then
if request.Form("id")="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
  if Not isInteger(request.form("id")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的id参数。"
  End if
End if
if founderr then
  Call diserror()
  response.End
End if
sql="select * from p_class_small where p_small_id="&cint(request.Form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
p_old_small_type=rs("p_small_type")
p_type=trim(replace(request.form("p_type"),"'",""))
p_small_type=trim(replace(request.form("p_small_type"),"'",""))
if p_small_type="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称!"
else
  rs("p_small_type")=p_small_type
End if
if Not founderr then
rs("p_type")=p_type
rs.update
rs.close
set rs=Nothing
'连代更新属于此小类的信息
v_sql="select * from p_info where p_small_type='"&p_old_small_type&"'"
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs("p_small_type")=p_small_type
v_rs.update
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
response.redirect "admin_p_class.asp"
else
Call diserror()
response.End
End if
End if

if request.form("action")="dels" then
if request.Form("id")="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
  if Not isInteger(request.form("id")) then
    founderr=true
    errmsg=errmsg+"<br>"+"<li>非法的id参数。"
  End if
End if
if founderr then
  Call diserror()
  response.End
End if
sql="select * from p_class_small where p_small_id="&cint(request.Form("id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if Not(rs.BOF or rs.EOF) then
p_small_type=rs("p_small_type")
rs.delete
End if
rs.close
set rs=Nothing
'连代删除属于此分类的信息
v_sql="select * from p_info where p_small_type='"&p_small_type&"'"
set v_rs=server.createobject("adodb.recordset")
v_rs.open v_sql,conn,1,3
if Not(v_rs.BOF or v_rs.EOF) then
do while not v_rs.eof
v_rs.delete
v_rs.movenext
loop
End if
v_rs.close
set v_rs=Nothing
closedatabase
response.redirect "admin_p_class.asp"
End if
End if

Call p_class_body()
closedatabase
%>